1. Field of Invention
The invention relates to a data writing method and, in particular, to a data writing method for an RAID.
2. Related Art
A hard disk (HD) is one of the most popular storage devices in the personal computer (PC). In the PC, the slow access speed of the HD slower than that of the CPU and RAM is one of the key points affecting the system speed. Recently, the servers are widely applied, and the professional audio/video (AV) system needs the storage device with large capacity and high speed. In order to speed up the flow of the computer system for enhancing the process performance, the redundant arrays of inexpensive disks (RAID) system has became the best choice.
The RAID can increase the process performance of the system by storing the data, which is divided, in different disks. Besides, according to the concept and method of parity calculation, the RAID can recover the original data stored in one failed hard disk so as to increase the data safety stored therein.
The RAID system is to simulate a logic hard disk in the system with more than two hard disks, and an RAID controller is used to simulate the various RAID prototypes according to the array types. At recent, the popular RAID prototypes are RAID 0, RAID 1, RAID 3, RAID 4, and RAID 5.
A conventional writing method for the RAID, such as RAID 5, includes the steps of dividing one data into a plurality of segmented data, storing the segmented data into the different hard disks, obtaining the parity data by an XOR logic operation of the segmented data, and writing the parity data into the hard disk. Herein, the number of the segmented data is depended on the number of the hard disks.
Therefore, the system needs three subcommands to perform the following steps during a write cycle. The first step is to write the segmented data into the hard disk. The second step is to read the segmented data to perform the logic operation. The third step is to write the parity data into the hard disk. In other words, the system needs three clocks to perform the data writing command for the RAID.
Although the conventional writing method just use three clocks to perform the data writing command for the RAID, it will waste much time when the RAID processes a large numbers of data writing commands. It is therefore an important subject to save the time for performing the writing command for the RAID to increase the efficiency of the RAID.